package com.caine.multithread;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.LongAdder;

/**
 * @Author: CaineZhu
 * @Description:
 * @Date: Created in 16:10 2020/12/22
 * @Modified By:
 */
public class LongAdderTest {
    static LongAdder count = new LongAdder();
    public static void add(){
        count.increment();
    }
    public static void main(String[] args) throws InterruptedException {
        for (int i=0;i<1000;i++)
         new Thread(()->add()).start();

        TimeUnit.SECONDS.sleep(5);
        System.out.println("count.intValue() = " + count.intValue());
    }

}
